from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import Config

from flask_socketio import SocketIO

socketio = SocketIO(cors_allowed_origins='*',ping_timeout=20, ping_interval=5)
db = SQLAlchemy()

def create_app():
    app = Flask(__name__)

    app.config.from_object(Config)

    db.init_app(app)
    socketio.init_app(app)

    from api.apps.login import login_app
    app.register_blueprint(login_app)

    from api.apps.polish import polish_app
    app.register_blueprint(polish_app)

    return app